package com.hsylient.javase.draftpaper;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;

import java.math.BigDecimal;

public class BeanCopyTest {

    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.setId(1001L);
        cat.setAge(11);
        cat.setName("11");
        cat.setSalary(BigDecimal.valueOf(2.22));
        cat.setGender(true);

//        Dog dog = BeanUtil.copyProperties(cat, Dog.class, "id", "gender");
//        System.out.println(dog);
//        Dog dog2 = BeanUtil.copyProperties(cat, Dog.class, "id");
//        System.out.println(dog2);
//        Dog dog3= BeanUtil.copyProperties(cat, Dog.class);
//        System.out.println(dog3);
        Dog dog4 = new Dog();
        dog4.setId(2002L);
//        BeanUtil.copyProperties(cat, dog4);
//        System.out.println(dog4);


    }


    @Data
    public static class Cat {
        private Long id;
        private String name;
        private BigDecimal salary;
        private Integer age;
        private Boolean gender;
    }

    @Data
    public static class Dog {
        private Long id;
        private String name;
        private BigDecimal salary;
        private Integer age;
        private Boolean gender;
    }
}
